﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using Microsoft.Xna.Framework;

namespace TinyEngine.Editor.Extensibility.Controls
{
    public partial class NumberControl : UserControl
    {
        bool isVector3;
        public NumberControl(string name)
        {
            InitializeComponent();
            lblName.Text = name;
        }

        private Single number;
        public Single Number
        {
            get { return number; }
            set
            {
                number = value;
                txtX.Text = number.ToString();
            }
        }

        public event Action NumberChanged;

        private void txtX_TextChanged(object sender, TextChangedEventArgs e)
        {
            var txtValX = txtX.Text;
            Single num = 0;
            if (Single.TryParse(txtValX, out num))
            {
                number = num;
            }

            
            if(NumberChanged != null)
                NumberChanged();
        }

    }
}
